#pragma once

#include <QMainWindow>
#include <QPushButton>
#include "page/wordpage.h"
#include "page/studypage.h"
#include "page/datapage.h"
#include "page/communitypage.h"
#include "page/userpage.h"
#include "page/vocabwordspage.h"
#include "util/serverhelper.h"
#include "util/usermanager.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

namespace WordMemory
{
    class MainWindow : public QMainWindow
    {
        Q_OBJECT

    public:
        MainWindow(QWidget *parent = nullptr);
        ~MainWindow();

    private slots:
        void on_wordButton_clicked();
        void on_studyButton_clicked();
        void on_dataButton_clicked();
        void on_communityButton_clicked();
        void on_userButton_clicked();

        void on_showVocabWordsPage(const Vocabulary &vocabulary);
        void on_backToStudyPage();
        void on_wordSelected(const QString &word);
        void onSearchWordAndSwitchPage(const QString &word);

    private:
        void setupConnections();
        void setupStyles();
        void switchButtonCheckedState(QPushButton* button);

        Ui::MainWindow *ui;
        WordPage *wordPage;
        StudyPage *studyPage;
        DataPage *dataPage;
        CommunityPage *communityPage;
        UserPage *userPage;
        VocabWordsPage *vocabWordsPage;
    };
}
